package day14_io.demo07_ObjectOutputStream;

import java.io.Serializable;

//接口Serializable没有任何方法
//只起到标识的作用，标识当前类可以进行序列化和反序列化

//成员变量如何不被序列化？
//给该成员加上一个transient关键字修饰，标识了该成员不参与序列化
public class Student implements Serializable {
    public static final long serialVersionUID =10001;
    private String name;
    private transient int age;//transient关键字修饰,成员变量不被序列化
    private int sum=100;

    public Student() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
